package action;

import service.Feature;

public class RunFeatureComputation {
	public static final String filename="D:\\重要文档\\江老师\\bug_priority_data_tianyuan\\Last.txt";

	public void runFeatureComputation(String featureName){
		Feature instance = new Feature();
		long start = System.currentTimeMillis();
		instance.readBigFile(filename);
		if("Author".equals(featureName)){
			instance.computeAuthorFeature();
			long end = System.currentTimeMillis();
			System.out.println("计算用时="+(end-start)/1000);
			System.out.println(featureName+"类特征计算完成，请看authorFeature.txt文件");
		}else if("Temporal".equals(featureName)){
			instance.computeHyperFeature();
			long end = System.currentTimeMillis();
			System.out.println("计算用时="+(end-start)/1000);
			System.out.println(featureName+"类特征计算完成，请看temporalFeature.txt文件");
		}else if("Severity".equals(featureName)){
			instance.computeSeverity();
			long end = System.currentTimeMillis();
			System.out.println("计算用时="+(end-start)/1000);
			System.out.println(featureName+"类特征计算完成，请看severity.txt文件");
		}else if("Priority".equals(featureName)){
			instance.computePriority();
			long end = System.currentTimeMillis();
			System.out.println("计算用时="+(end-start)/1000);
			System.out.println(featureName+"类特征计算完成，请看priority.txt文件");
		}else if("Product".equals(featureName)){
			instance.computeProductFeature();
			long end = System.currentTimeMillis();
			System.out.println("计算用时="+(end-start)/1000);
			System.out.println(featureName+"类特征计算完成，请看productFeature.txt文件");
		}else if("Compoment".equals(featureName)){
			instance.computeCompomentFeature();
			long end = System.currentTimeMillis();
			System.out.println("计算用时="+(end-start)/1000);
			System.out.println(featureName+"类特征计算完成，请看componentFeature.txt文件");
		}else if("VectorModelTF".equals(featureName)){
			instance.computeVectorModelTF();
			long end = System.currentTimeMillis();
			System.out.println("计算用时="+(end-start)/1000);
			System.out.println(featureName+"类特征计算完成，请看tfVector.txt文件");
		}else if("BugID".equals(featureName)){
			instance.outBugID();
			long end = System.currentTimeMillis();
			System.out.println("计算用时="+(end-start)/1000);
			System.out.println(featureName+"类特征计算完成，请看bugID.txt文件");
		}else{
			System.out.println("featureName 有误，请检查");
		}
	}
}
